package com.xiaotian.common.response;

import com.xiaotian.common.code.CommonCode;
import lombok.Data;

@Data
public class Result {

    private boolean success;

    private int code;

    private String message;

    public Result(ResultCode resultCode) {
        this.success = resultCode.success();
        this.code = resultCode.code();
        this.message = resultCode.message();
    }

    public static Result success() {
        return new Result(CommonCode.SUCCESS);
    }

    public static Result fail() {
        return new Result(CommonCode.FAIL);
    }
}
